package flextv.core.vo {

import flextv.core.download.IDownloadable;
	
[Bindable]
public class StoredItem implements IItem, IDownloadable, IPlayable {
	
	private var _id: uint;
	
	/** YouTube ID (read-only) */
	private var _yid: String;
	
	/** Displayed movie title */
	private var _title: String;
	
	/** from IDownloadable */
	public var downloaded: uint;
	
	private var _duration: uint;
	
	private var _fileUri: String;
	
	private var _playlistId: uint;
	
	private var _thumbnailUrl: String;
	
	public function StoredItem(yid: String = "", title: String = "", duration: uint = 0, fileUri: String = "", thumbnailUrl: String = "") {
		if(yid == null) throw new ArgumentError("yid == null");
		if(title == null) throw new ArgumentError("title == null");
		// if(fileUri == null) throw new IllegalArgumentError("fileUri == null");
		if(duration < 0) throw new ArgumentError("duration [" + duration + "] < 0");
		
		_yid = yid;
		_title = title;
		_duration = duration;
		_fileUri = fileUri;
		_thumbnailUrl = thumbnailUrl;
	}
	

	public function toString(): String {
		return "StoredItem[id="+_id+";title="+_title+";yid="+_yid+"]";
	}
	
	public function get id(): uint {
		return _id;
	}
	
	public function set id(value: uint): void {
		_id = value;
	}
	
	public function get yid(): String {
		return _yid;
	}
	
	/** for SQLite only */
	public function set yid(value: String): void {
		_yid = value;
	}
	
	public function get title(): String {
		return _title;
	}
	
	public function set title(value: String): void {
		_title = value;
	}
	
	/** from IPlayable */
	public function get duration(): uint {
		return _duration;
	}
	
	/** for SQLite only */
	public function set duration(value: uint): void {
		_duration = value;
	}
	
	/** from IPlayable */
	public function get fileUri(): String {
		return _fileUri;
	}
	
	/** for SQLite only */
	public function set fileUri(value: String): void {
		_fileUri = value;
	}
	
	public function get playlistId(): uint {
		return _playlistId;
	}
	
	public function set playlistId(value: uint): void {
		_playlistId = value;
	}
	
	public function get thumbnailUrl(): String {
		return _thumbnailUrl;
	}
	
	public function set thumbnailUrl(value: String): void {
		_thumbnailUrl = value;
	}
	
}
}